package com.common.retrofit.methods;

import com.common.retrofit.base.BaseMethods;
import com.common.retrofit.entity.result.HouseListBean;
import com.common.retrofit.service.HaiNingService;

import java.util.ArrayList;

import rx.Observable;
import rx.Subscriber;

public class RentHouseMethods extends BaseMethods {

    private static RentHouseMethods m_ins = null;

    public static RentHouseMethods getInstance() {
        if (m_ins == null) {
            synchronized (RentHouseMethods.class) {
                if (m_ins == null) {
                    m_ins = new RentHouseMethods();
                }
            }
        }
        return m_ins;
    }

    @Override
    protected String getHttpUrl() {
        return "House/";
    }

    private HaiNingService initService() {
        return getRetrofit().create(HaiNingService.class);
    }

    // 获取首页数据
    public void screen_rental_house(Subscriber<ArrayList<HouseListBean>> subscriber, String city_str
            , String area_str, int house_rent, int house_room_num, int acreage, int house_renovation, int house_type, int small_price
            , int big_price
            , int page) {
        Observable observable = initService().screen_rental_house(System.currentTimeMillis() + "",
                "7304e3609ec840528195d2a66cf44c33", city_str,area_str,house_rent,house_room_num,acreage,house_renovation,house_type,small_price,big_price,page
        );
        toSubscribe(observable, subscriber);
    }
}
